package pl.grabar.clinic.client.web.actions.admin.users;

import java.util.HashMap;
import java.util.Map;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Actions;
import org.apache.struts2.convention.annotation.InterceptorRef;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;

import pl.grabar.clinic.core.domain.enums.UserType;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;

@Actions({@Action(""), @Action("list")})
@InterceptorRef("grabarStack")
@Results({ @Result(name = "success", location = "list.jsp"), @Result(name = "input", location = "list.jsp") })
public class ListUsersAction extends ActionSupport implements Preparable {

	private static final long serialVersionUID = 7200934129636773309L;

	private Map<UserType,String> userTypes = new HashMap<>();
	
	@Override
	public void prepare() throws Exception {
		userTypes.put(UserType.ADMIN, getText("pl.grabar.clinic.client.web.labels.admin"));
		userTypes.put(UserType.DOCTOR, getText("pl.grabar.clinic.client.web.labels.doctor"));
		userTypes.put(UserType.USER, getText("pl.grabar.clinic.client.web.labels.user"));
		userTypes.put(UserType.RECEPTIONIST, getText("pl.grabar.clinic.client.web.labels.receptionist"));
	}

	@Override
	public String execute() throws Exception {
		return SUCCESS;
	}

	public Map<UserType, String> getUserTypes() {
		return userTypes;
	}

	public void setUserTypes(Map<UserType, String> userTypes) {
		this.userTypes = userTypes;
	}
}
